{% extends 'ViettransFrontBundle::layout.html.twig' %}

{% block breadscrumb %}
    {% render 'ViettransFrontBundle:Partial:breadScrumb' with {'request':app.request} %}
{% endblock %}

{% block search %}
    {% render 'ViettransFrontBundle:Partial:search' with {'request':app.request} %}
{% endblock %}

{% block pagination %}
    {% render 'ViettransFrontBundle:Partial:pagination' with {'request':app.request} %}
{% endblock %}

{% block body %}
<div id="announcement_index">
    <div id="announcements">
        {% for id, announcement in announcements %}
            <div class="grid_12">
                <div class="announcement">
                    <div class="title">
                        <div class="user">
                            {% if announcement.userId %}
                                <img class="user_icon" alt="" title="Người dùng : {{ announcement.userObj.name }}" src="{{ asset('images/iconUser.png') }}" />
                            {% endif %}
                        </div>
                        <a title="{{ announcement.title }}" href="{{ path('announcement_show', {'id': announcement.id}) }}">{{ announcement.title }}</a>
                    </div>

                    <div class="grid_8">
                        <div class="date_time">
                            <div class="date">
                                <b>
                                    {% if announcement.beginsAt|date("m/d/Y") == "now"|date("m/d/Y") %}
                                        Hôm nay
                                    {% else %}
                                        {{ announcement.beginsAt|date('d/m') }}
                                    {% endif %}
                                </b>
                            </div>
                            <div class="time"> - <b>{{ announcement.beginsAt|date('H\\h i') }}</b></div>
                        </div>

                        <div class="grid_4">
                            <div class="btns">
                                <img class="alertBadAnnouncementBtn" alt="alert" title="Cảnh báo tin xấu" src="{{asset('images/iconAlert.gif')}}" />
                                <div class="alertBadAnnouncementForm panel_ajax">
                                    <div class="btnClose"></div>
                                    <div class="title">Cảnh báo tin xấu</div>
                                    <input class="alertBadAnnouncementMessage" autocomplete="off" type="text" />
                                    <input class="announcementId" type="hidden" value="{{announcement.id}}" />
                                    <button class="btnOk" value="{{announcement.id}}" >OK</button>
                                </div>
                            </div>
                        </div>
                       
                        <div class="price grid_3" align="right">{{ announcement.price != '' ? announcement.price ~ ' €' : '-' }}</div>
                       
						<div class="clear"></div>
                        
                        <div class="category"><i>{{ announcement.categoryObj.name }}</i></div>
						
						<div class="clear"></div>
                        
                         <div class="locality"><i>{{ announcement.townObj.name }} ({{ announcement.townObj.code }})</i></div>
                        
						<div class="grid_11" id="message_{{announcement.id}}">&nbsp;</div>	
					</div>

                    <div class="photo">
                        <a title="{{ announcement.title }} {{ (announcement.price) ? '(' ~ announcement.price ~ ' €)' : '' }}" class="preview" href="{{ asset(announcement.photos != '' ?'images/announcement/photo/' ~ announcement.photos ~ '.jpg' : 'images/announcement/thumb/noThumb80x60.jpg') }}">
        					<img alt="photo" src="{{ asset(announcement.photos != '' ?'images/announcement/thumb/' ~ announcement.photos ~ '.jpg' : 'images/announcement/thumb/noThumb80x60.jpg') }}" />
						</a>
                    </div>
                </div>
            </div>
        {% else %}
            <div class="grid_24">
                <div class="announcement">
                    <div class="error">{{ 'announcement.index.empty.text' | trans }}</div>
                </div>
            </div>
            <div class="clear"></div>
        {% endfor %}
    </div>
</div>
{% render 'ViettransFrontBundle:Partial:pagination' with {'request':app.request} %}

{% endblock %}